package com.example.yls.demoa;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

/**
 * Created by yls on 2018/11/6.
 */

public class MyBroadcastReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        String action = intent.getAction();

        if (action.equals("weather_info")) {
            String weather = intent.getStringExtra("weather");
            int wendu = intent.getIntExtra("温度", 0);
            Log.e("MyBroadcastReceiver", "onReceive weather" + weather+" " + "温度" +" "+ wendu);
        }else {
            String traffic = intent.getStringExtra("traffic");
            int time = intent.getIntExtra("时间", 0);
            Log.e("MyBroadcastReceiver", "onReceive traffic" + traffic+" " + "时间"+" " + time);
        }
    }
}
